﻿Imports System.Drawing
Imports NUnit.Framework

<TestFixture()> _
Public Class RechenwerkTests
    <Test()> _
    Sub teste_Process_x_Quadrat()
        Dim sut As New Global.funktionsplotter.rechenwerk.Rechenwerk()

        Dim xWerte As Double() = New Double() { _
            1, 2, 3, 4, 5 _
        }
        Dim pts As System.Collections.Generic.IEnumerable(Of System.Drawing.Point) = sut.Process(New Tuple(Of Func(Of Double, Double), IEnumerable(Of Double))(Function(x) x * x, xWerte))

        Dim erwartet As Point() = New Point() { _
            New Point(1, 1 ^ 2), _
            New Point(2, 2 ^ 2), _
            New Point(3, 3 ^ 2), _
            New Point(4, 4 ^ 2), _
            New Point(5, 5 ^ 2) _
        }

        Assert.AreEqual(erwartet, pts)
    End Sub

    <Test()> _
    Sub teste_Process_Addition_mit_x()
        Dim sut As New Global.funktionsplotter.rechenwerk.Rechenwerk()

        Dim xWerte As Double() = New Double() { _
            1, 2, 3, 4, 5 _
        }
        Dim pts As System.Collections.Generic.IEnumerable(Of System.Drawing.Point) = sut.Process(New Tuple(Of Func(Of Double, Double), IEnumerable(Of Double))(Function(x) 3 + x, xWerte))

        Dim erwartet As Point() = New Point() { _
            New Point(1, 4), _
            New Point(2, 5), _
            New Point(3, 6), _
            New Point(4, 7), _
            New Point(5, 8) _
        }

        Assert.AreEqual(erwartet, pts)
    End Sub
End Class
